/**
 * 核心模块统一导出
 * 包含所有核心业务逻辑和引擎功能
 */

// 引擎模块导出
export * from './engine'

// 动画系统导出
export * from './animation'

// 角色系统导出
export * from './character'

// 场景系统导出
export * from './scene'

// 时间轴系统导出
export * from './timeline'

// 核心系统工厂函数
export const createCoreSystem = () => {
  return {
    // 引擎实例
    animationEngine: () => import('./engine').then(m => m.animationEngine),
    createRenderEngine: (canvas: HTMLCanvasElement, config?: any) =>
      import('./engine').then(m => m.createRenderEngine(canvas, config)),

    // 管理器实例
    animationController: () => import('./animation').then(m => m.defaultAnimationController),
    characterManager: () => import('./character').then(m => m.defaultCharacterManager),
    sceneManager: () => import('./scene').then(m => m.defaultSceneManager),
    timelineManager: () => import('./timeline').then(m => m.defaultTimelineManager),
  }
}

// 核心系统初始化函数
export const initializeCoreSystem = async () => {
  const [
    { animationEngine },
    { defaultAnimationController },
    { defaultCharacterManager },
    { defaultSceneManager },
    { defaultTimelineManager }
  ] = await Promise.all([
    import('./engine'),
    import('./animation'),
    import('./character'),
    import('./scene'),
    import('./timeline')
  ])

  return {
    animationEngine,
    animationController: defaultAnimationController,
    characterManager: defaultCharacterManager,
    sceneManager: defaultSceneManager,
    timelineManager: defaultTimelineManager
  }
}
